import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Pokers {

    public static final String[] SUIT = {"♣", "♦", "♠", "♥"};
    List<Poker> pokerList = new ArrayList<>();

    public List<Poker> addPoke(List<Poker> pokerList){

        for (int i = 0; i < 4; i++) {
            String suit = SUIT[i];
            for (int j = 1; j < 14; j++) {
                Poker poker = new Poker(suit,j);
                pokerList.add(poker);
            }
        }
        return pokerList;
    }

    public void displayPoker(List<Poker> pokerList){
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 13; j++) {
                System.out.print(pokerList.get(i*13+j)+" ");
            }
            System.out.println();
        }
    }

    public void swap(List<Poker> pokerList, int i, int j){
        Poker tmp = pokerList.get(i);
        pokerList.set(i, pokerList.get(j));
        pokerList.set(j,tmp);
    }

    public void shufle(List<Poker> pokerList){
        Random random = new Random();
        for (int i = pokerList.size()-1; i > 0 ; i--) {//为啥不能等于0
            int index = random.nextInt(i);
            swap(pokerList, i, index);
        }
    }
}
